Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't error on SSH_AGAIN in discard_output #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

itsfarseen
Copy link

As per the docs of ssh_channel_read_timeout:

The number of bytes read, 0 on end of file or SSH_ERROR
on error. In nonblocking mode it can return 0 if no data
is available or SSH_AGAIN.

SSH_AGAIN is -2. So it was hitting the nbytes < 0 branch and exiting with an error. Changed it to have the same behaviour as nbytes == 0

Reference: https://api.libssh.org/master/group__libssh__channel.html#ga2f4e02cb3b3adbc30a534623164068fd

@itsfarseen itsfarseen changed the title Don't error on SSH_AGAIN. Don't error on SSH_AGAIN in discard_output Sep 24, 2024
As per the docs of `ssh_channel_read_timeout`:
> The number of bytes read, 0 on end of file or SSH_ERROR
> on error. In nonblocking mode it can return 0 if no data
> is available or SSH_AGAIN.

SSH_AGAIN is -2. So it was hitting the `nbytes < 0` branch and exiting with an error.
Changed it to have the same behaviour as `nbytes == 0`

Reference: https://api.libssh.org/master/group__libssh__channel.html#ga2f4e02cb3b3adbc30a534623164068fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant